package com.wryyyyy.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebConfig implements WebMvcConfigurer {
    /***
     * 自定义资源映射
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/images/**") // http请求路径
//                .addResourceLocations("file:src/main/resources/static/files/images/"); // 资源路径
        // 图片回显
        registry.addResourceHandler("/**") // http请求路径
                .addResourceLocations("file:src/main/resources/static/files/"); // 资源路径
        // swagger
        registry.addResourceHandler("swagger-ui.html")
                .addResourceLocations("classpath:/META-INF/resources/");
    }
    // 原文链接：https://blog.csdn.net/m0_71849274/article/details/125681899
}